<template>
	
	<view>
		
		<view class="content">
			
			<view class="c-item">
				<view class="ci-title">训练对比</view>
				<view class="sep"></view>
				<view class="ci-content">
					<textarea placeholder="输入学员训练对比" v-model="cmp_text">{{cmp_text}}</textarea>
				</view>
			</view>
			<button class="btn-save" @tap="save()">保存</button>
		</view>

	</view>
	
</template>

<script>
	
	var app = getApp();
	
	export default{
		data(){
			return {
				cmp_text:'',
				user_id:0
			}
		},
		onLoad(option) {
			let that = this;
			that.user_id = (option && option.user_id) ? option.user_id : 0
			that.get_orderuser_main();
		},
		methods:{
			get_orderuser_main(){
				let that = this;
				app.post('ApiYuyueOrder/get_orderuser',{
					user_id:that.user_id,
					type:'eval'
					},(resp)=>{
					if(resp.status == 200){
						var data = resp.msg;
						that.cmp_text = data.cmp_text;
					}
				});
			},
			save(){
				let that = this;
				if(that.cmp_text.length == 0){
					app.alert('请输入学员训练对比');
					return;
				}
				
				var post = {
					type:'eval',
					user_id:that.user_id,
					cmp_text:that.cmp_text
				};
				
				app.post('ApiYuyueOrder/save_orderuser',post,(resp)=>{
					
					if(resp.status == 200){
						app.alert(resp.msg,()=>{
							app.goto('/activity/yuyue/orderusers');
						});
					}else{
						app.alert(resp.msg);
					}
					
				});
				
			}
		}
	}
	
</script>

<style>
	
	.content{
		height: auto;
	}
	
	.c-item{
		display: flex;
		flex-direction: column;
		padding: 0.5rem;
		margin-bottom: 1rem;
	}
	
	.sep{
		height: 0.01rem;
		background-color: #b4b4b4;
		width: 100%;
		margin-bottom: 0.25rem;
	}
	
	.ci-content{
		height: 8rem;
		width: 100%;
	}
	
	.ci-content textarea{
		background-color: white;
		border: 0.01rem solid #aeaeae;
		border-radius: 0.25rem;
		width: 100%;
		padding: 0.25rem;
		outline: none;
	}
	
	.btn-save{
		background-color: #00aaff;
		border-radius: 0.35rem;
		width: 6rem;
		margin-left: auto;
		margin-right: auto;
		margin-top: 2rem;
		color: white;
	}
	
	
	
	
</style>